<template>
  <div class="result">
    <div class="camp">
      <h1 class="title">Gourmet! <small>グルメ！<span class="ch">美食家！</span></small></h1>
    </div>
    <div class="if" v-if="$store.getters.resultInfo != null">
      <p class="text title">CERTIFICATE</p>
      <div class="content">
        <div class="left">
          <p class="text lg">食品图像分类</p>
          <p class="text md">FOOD IMAGE CLASSIFY</p>
          <img :src="$store.getters.imageUrl" alt="image" class="image">
        </div>
        <div class="right">
          <p class="text explain">
            &nbsp;&nbsp;&nbsp;&nbsp;经过本平台人工智能的一番认真严密的计算分析与鉴定，DDL科技对于此图片给出的分析结果如下：
          </p>
          <p class="text result">鉴定结果：<b>{{ $store.getters.resultInfo.result }}</b></p>
          <p class="text result">置信度：<b>{{ $store.getters.resultInfo.score }}</b></p>
        </div>
      </div>
    </div>
    <div class="else" v-else>
      <p class="tag"><b>Waiting! </b>请稍等！</p>
      <div class="progress">
        <el-progress type="circle" :percentage="percentage" :width="260"></el-progress>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Result',
  data() {
    return {
      // 进度条的进度
      percentage: 0
    }
  },
  mounted() {
    // 执行进度条的进度
    setInterval(() => {
      if (this.percentage < 100) {
        this.percentage += 2
      }
    }, 1000)
  }
}
</script>

<style lang="scss">
.result {
  background: url('~@/assets/online/head.png') center no-repeat;
  background-size: 400px 400px;

  .camp {
    color: #1acfff;
    padding-top: 40px;
    padding-bottom: 40px;

    .title {
      font-size: 56px;
      text-align: center;
      text-shadow: 4px 4px 4px #1a7cf5;

      small {
        font-size: 32px;
        text-shadow: 2px 2px 2px #1a7cf5;

        .ch {
          color: #d5d6e6;
          text-shadow: 2px 2px 2px #b2b3b4;
        }
      }
    }
  }

  .if {
    width: 940px;
    height: 580px;
    margin: 0 auto;
    background: url('~@/assets/online/certificate.jpg') center no-repeat;
    background-size: 940px 580px;

    .text {
      color: #315888;
    }

    .title {
      font-size: 46px;
      font-weight: bold;
      text-align: center;
      padding-top: 92px;
      padding-bottom: 28px;
      font-family: "Times New Roman", Georgia, Serif;
    }

    .content {
      display: flex;
      flex-direction: row;

      .left {
        width: 46%;
        padding-left: 96px;

        .lg {
          font-size: 24px;
          font-weight: bold;
          padding-left: 100px;
        }

        .md {
          font-size: 18px;
          padding-left: 70px;
          padding-top: 12px;
        }

        .image {
          max-width: 320px;
          max-height: 240px;
          padding-top: 20px;
        }
      }

      .right {
        width: 50%;

        .explain {
          width: 320px;
          font-size: 18px;
          padding-top: 16px;
          padding-bottom: 16px;
        }

        .result {
          width: 320px;
          font-size: 22px;
          padding-top: 26px;
        }
      }
    }
  }

  .else {
    width: 840px;
    margin: 0 auto;

    .tag {
      font-size: 32px;
      text-align: center;
      padding-top: 12px;
      padding-bottom: 40px;

      b {
        color: #1acfff;
      }
    }

    .progress {
      width: 260px;
      margin: 0 auto;
    }
  }
}
</style>
